
var api = require('../../utils/api.js');
var app = getApp();
Page({
    data: {
        tophe:0,
        lists:[]
    },
    currentPageNumber: 1,
        onLoad() {
        var file=api.FIlE;
        this.setData({
            bg:file
        })
        this.getallmessage();
    },
    onShow() {
        let jn = wx.getMenuButtonBoundingClientRect();

        console.log(jn);
        var tophe=jn.top+jn.height+15;
        this.setData({
            tophe:tophe+'px',
            over:jn.top
        })
     
    },
    back(){
        wx.navigateBack();
    },
    getallmessage(){
        var that=this;
        api.post({
            url: 'zixun/getzixunbytype',
            data: {},
            success: data => {
                that.setData({
                    lists:data.data
                });
            },
        });
    },
    
    // 切换问题答案的显示状态
    toggleAnswer(e) {
        const index = e.currentTarget.dataset.index;
        const key = `lists[${index}].showAnswer`;
        this.setData({
            [key]: !this.data.lists[index].showAnswer
        });
    }
});